package com.example.demo.configuration;

import com.example.demo.model.UserInfo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

@Component
public class UserConfig {
    @Bean(name = {"userName1","user1"})
    public UserInfo usr1(){
        UserInfo userInfo=new UserInfo();
        userInfo.setId(1);
        userInfo.setName("zhangSan");
        userInfo.setAge(11);
        return userInfo;
    }

    @Bean(name = {"userName2","user2"})
    public UserInfo usr2(){
        UserInfo userInfo=new UserInfo();
        userInfo.setId(2);
        userInfo.setName("LiSi");
        userInfo.setAge(12);
        return userInfo;
    }

    @Bean(name = {"userName3","user3"})
//    @Primary
    public UserInfo usr3(){
        UserInfo userInfo=new UserInfo();
        userInfo.setId(3);
        userInfo.setName("王五");
        userInfo.setAge(13);
        return userInfo;
    }
}
